#delimit ;

/*****************************************
This program is called to prep the regressions
*******************************************/
keep if male != . & white != . &
   hispanic!= . & black !=.   ;

keep if deglevl_code == "05" ;

/*************************************
Restricting sample to those age 18-65
*************************************/
gen age = year - year(DOB) ;
keep if age>=18 & age <= 65 ; 
keep  if year_grad >= 2001 & year_grad <=2013 ;
keep if year >= 2000 ;
sum national_earnings, d;
keep if national_earnings <r(p99) ;

 bys pik year: egen stateqtr_count = sum((instate_earnings > 0 & instate_earnings != . ));
  bys pik year: egen natqtr_count = sum((national_earnings>0 & national_earnings!=.)) ;

gen instate_sample= (stateqtr_count == 4 & year > year_grad ) ;
gen national_sample = (natqtr_count == 4 & year> year_grad ) ;


tab ui_state, gen(inst_state) ;


gen log_earn_national = log(national_earnings) ;
gen log_earn_instate = log(instate_earnings) ;
gen log_earn_instate_sandwich = log(instate_sandwich_earnings) ;
gen log_earn_national_sandwich = log(national_sandwich_earnings) ; 


